Dr. Alex Singleton of the University of Liverpool shows us how to generate neighborhood clusters for Liverpool, UK. Using a large dataset with dozens of variables, we can organize smaller geometries into seven clusters that are similar to each other across three main categories: demographic, housing and socio-economics. Cluster maps like these reveal the true shape of urban fabric; neighborhoods and regions are not perfect tessalating hexagons, but rather complex shapes that can be drawn out with this sort of quantitiative method.
Below is our map of Livepool clusters.
library(tmap)
library(sf)
## Linking to GEOS 3.8.0, GDAL 3.0.4, PROJ 6.3.1
liverpool_SP1 <- st_read('liverpool_SP.shp') # Read in the data
## Reading layer `liverpool_SP' from data source `C:\Users\justi\Documents\UChicago 19-20\Spring\GIS III\wd\lab6\data\liverpool_SP.shp' using driver `ESRI Shapefile'
## Simple feature collection with 1584 features and 3 fields
## geometry type: MULTIPOLYGON
## dimension: XY
## bbox: xmin: 333086.1 ymin: 381424.1 xmax: 345636 ymax: 397980.1
## projected CRS: Transverse_Mercator
tmap_mode("view")
## tmap mode set to interactive viewing
tm_shape(liverpool_SP1, # Identify the object to be mapped
projection=27700) + # Set projection
tm_fill(col="SUPER", # Identify the variable to be mapped
palette="Set3", # Set a categorical color palette from RColorBrewer
alpha = 0.6, # Set ploygons to be a but transparent, so the basemap is visible underneath
title="Cluster", #Set a title for the legend
showNA=FALSE) + # Omit geometries without a value for cluster
tm_layout( # Add a legend
title = "Population Clusters in Liverpool, UK" # Add a title to the map
) +
tm_basemap(leaflet::providers$Esri.WorldGrayCanvas) #Specify the basemap to show
## Warning: The shape liverpool_SP1 is invalid. See sf::st_is_valid